You are here: Symbol Reference > Dew Namespace > Dew.Stats Namespace > Dew.Stats.Units Namespace > Classes > Statistics Class > Statistics Methods > Histogram Method > Statistics.Histogram Method ([In] TVec, [In] TVec, [In] TVec)
Dew Stats for .NET
ContentsIndexHome
PreviousUpNext
Statistics.Histogram Method ([In] TVec, [In] TVec, [In] TVec)

Histogram.

Syntax
C#
Visual Basic
public static void Histogram([In] TVec Data, [In] TVec Bins, [In] TVec Results);

Divide the Data vector elements into intervals, specified by the Bins vector. The Bins elements define the center points for the intervals. The Bins elements must be sorted in ascending order. The number of elements falling in each interval is counted and the result for each interval (frequency distribution) is written to the Results vector. The Length and Complex properties of the Results vector are adjusted automatically. 

Note Use this version if you need non-equidistant histogram.

This example constructs 4 unequal bins and counts the frequencies.

using Dew.Math; using Dew.Stats; using Dew.Stats.Units; namespace Dew.Examples { private void Example() { Vector data = new Vector(0); Vector bins = new Vector(0); Vector freq = new Vector(0); data.SetIt(false, new double[] {1,2,3,4,5,6,7,8,9,10}); // Centerpoints, note that values are sorted! bins.SetIt(false, new double[] {1.5, 2.0, 6.0, 9.0}); Statistics.Histogram(data,bins,freq); // Freq holds the count of elements in each bin } }
Copyright (c) 1999-2024 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!